﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


[ExecuteInEditMode]
public class SupplyStation : BaseContent
{

    public ESupplyType supplyType;
    public SpriteRenderer iconRenderer;

    public Sprite sprite_Love;
    public Sprite sprite_Game;
    public Sprite sprite_Food;
    public Sprite sprite_Icon_Love;
    public Sprite sprite_Icon_Game;
    public Sprite sprite_Icon_Food;

    // Start is called before the first frame update
    void Start()
    {
        
    }



    // Update is called once per frame
    void Update()
    {
        
    }


    protected new void OnEnable()
    {
        base.OnEnable();
        SpriteRenderer sr = GetComponent<SpriteRenderer>();
        if (supplyType == ESupplyType.Love)
        {
            sr.sprite = sprite_Love;
            iconRenderer.sprite = sprite_Icon_Love;
        }
        if (supplyType == ESupplyType.Game)
        {
            sr.sprite = sprite_Game;
            iconRenderer.sprite = sprite_Icon_Game;
        }
        if (supplyType == ESupplyType.Food)
        {
            sr.sprite = sprite_Food;
            iconRenderer.sprite = sprite_Icon_Food;
        }

    }

    public override void OnInteract(PlayerPawn interactor)
    {
        base.OnInteract(interactor);
        
        interactor.TryAddSupply(supplyType);
    }
}
